<template>
    <!-- 日历组 -->
    <div>
        <el-calendar>
            <!-- 这里使用的是 2.5 slot 语法，对于新项目请使用 2.6 slot 语法-->

            <template slot="dateCell" slot-scope="scope">
                <div>
                    <div :class="scope.data.isSelected ? 'is-selected' : ''">
                        {{ scope.data.day.split('-').slice(2).join('-') }} {{ scope.data.isSelected ? '✔️' : '' }}
                    </div>
                    <div style="height: 40px;" @click="dataHandler(scope.data.day)">
                        <template v-for="item, index in huihiu">
                            <span :key="index" v-if="item.date == scope.data.day">{{ item.schedule }}</span>
                        </template>

                    </div>
                </div>

            </template>


        </el-calendar>
    </div>
</template>

<script>
import { addscheduleApi, getscheduleApi } from '@/api/schedule'

export default {
    data() {
        return {
            fghtyty: {
                date: "2023-1-1",
                schedule: "oujiujn",

            },
            huihiu: []
        }
    },
    created() {
        this.getDate()
    },
    methods: {
        dataHandler(data) {
            this.$emit('dataHandler', data)
        },
        async getDate() {
            let res = await getscheduleApi()
            this.huihiu = res.data
            console.log(this.huihiu)
        }
    }
}
</script>

<style></style>